﻿using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Linq;
using System.Text;

namespace Eventbrite.LinqProvider.Translators
{
   public  class TakeTranslator:Helpers.ExpressionVisitor
    {
       internal static TakeTranslator GetFirstTranslator()
       {
           return new TakeTranslator
           {
               Count = 1,
            };
       }

       internal int? Count { get; private set; }
       internal bool IsDefaultSet { get; set; }

       internal void Translate(Expression exp)
       {
           Visit(exp);
       }

     
       protected override Expression VisitConstant(ConstantExpression c)
       {
           if (c.Type == typeof(Int32))
           {
               Count = (Int32)c.Value;
           }
           return c;
       }
    }
}
